package com.qf.dao.impl;

import com.qf.dao.StageDao;
import com.qf.pojo.Stage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Description: 公用常量
 * @Data: 2022/9/2 15:14
 * @Pacakge: com.qf.dao.impl
 * @ClassName: StageDaoImpl
 * @Author: fan
 */
@Repository("stageDao")
public class StageDaoImpl implements StageDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 查询所有工程阶段以及对象项目
     * @return
     */
    @Override
    public List<Stage> findAllStage() {
        return jdbcTemplate.query(
                "select * from stage left join project on stage.pid = project.pid where stage.status=1",
                new BeanPropertyRowMapper<Stage>(Stage.class));
    }
}
